using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Domain.Services;
using SOEI.Solution.Integratedes.Organization;

namespace SOEI.Solution.Integratedes.ElectronicSignet.DomainService
{
	/// <summary>
	/// 领域服务接口定义
	///</summary>
	public interface IOrgSignetManager : IDomainService
	{
		#region -------------------------------------------------辅助工具生成----------------------------------------------
		/// <summary>
		/// 返回表达式数的实体信息即IQueryable类型(可选择部分字段)
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<OrgSignet> QueryEntityListAsNoTracking();
		/// <summary>
		/// 返回表达式数的实体信息即IQueryable类型
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<OrgSignet> Query();
		/// <summary>
		/// 返回性能更好的IQueryable类型，但不包含EF Core跟踪标记
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<OrgSignet> QueryAsNoTracking();
		/// <summary>
		/// 【OrgSignet】根据Id查询实体信息
		/// </summary>
		/// <param name="id"></param>
		/// <returns>实体</returns>
		Task<OrgSignet> FindByIdAsync(long id);
		/// <summary>
		/// 【OrgSignet】检查实体是否存在
		/// </summary>
		/// <returns>是否成功</returns>
		Task<bool> IsExistAsync(long id);
		/// <summary>
		/// 【OrgSignet】添加实体
		/// </summary>
		/// <param name="entity">实体</param>
		/// <returns></returns>
		Task<OrgSignet> CreateAsync(OrgSignet entity);
		/// <summary>
		/// 【OrgSignet】修改实体
		/// </summary>
		/// <param name="entity">实体</param>
		/// <returns></returns>
		Task UpdateAsync(OrgSignet entity);
		/// <summary>
		/// 【OrgSignet】删除实体
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		Task DeleteAsync(long id);
		/// <summary>
		/// 【OrgSignet】批量删除
		/// </summary>
		/// <param name="input">Id的集合</param>
		/// <returns></returns>
		Task BatchDelete(List<long> input);
		#endregion

		#region -------------------------------------------------用户自定义------------------------------------------------
		/*请在此扩展领域服务接口*/

		/// <summary>
		/// 是否存在指定条件的印章实体
		/// </summary>
		/// <param name="organi">机构实体</param>
		/// <returns></returns>
		Task<bool> IsExistAsync(OEconomyOrgani organi);

		/// <summary>
		/// 获取一个电子签章数据，如果不存在则会创建一个
		/// </summary>
		/// <param name="organi">机构实体</param>
		/// <returns></returns>
		Task<OrgSignet> GetCreateOrgSignetAsync(OEconomyOrgani organi);


		/// <summary>
		/// 【电子签章】根据人员编号查询实体信息
		/// </summary>
		/// <param name="id"></param>
		/// <returns>实体</returns>
		Task<OrgSignet> FindByPersonIDAsync(string RYBH);

		/// <summary>
		/// 【电子签章】根据机构编号查询实体信息
		/// </summary>
		/// <param name="OrgID"></param>
		/// <returns></returns>
		Task<OrgSignet> FindByOrgIDAsync(string OrgID);


		/// <summary>
		/// 【电子签章】指定机构编是否可以进行签章申请
		///  1. 没有电子签章申请记录的 可以进行申请
		///  2. 审核状态为待提交记录的 可以进行申请
		///  3. 暂时其他状态都不允许在进行申请
		/// </summary>
		/// <param name="OrgID"></param>
		/// <returns></returns>
		Task<bool> UseSignet(string OrgID);

		#endregion
	}
}
